-- Project Manager's loneliness
A long time ago, I sent a trip to a programmer friend. After a long time of Self-torture, he chose relief: he resigned.
After pouring a beer, he said,"
I went to work at a.m., dragged my tired body back home at
confusion of logic from one state to the next. In addition, because the maximum number and the smallest number is also only a number of different, it is usually called gray Reflection code or loop code. The table below is a comparison of several natural binary codes and gray codes:
Decimal number
Natural binary Number
Gray Code
Decimal number
Natural
Basic Concepts
The level of a node is defined from the root. The root layer is the first layer, and the child of the root layer is the second layer.
The height of a binary tree: the maximum level of a node in the tree is called the depth or height of the tree.Binary Tree
In computer science, a binary tree is an ordered tree with a maximum of two Subtrees at each node. Generally, the root of a subtree is cal
Data structure of PHP 9: stores binary trees, creates binary trees, and performs basic operations on binary trees, and traverses binary tree algorithms.
Create a binary tree and basic operations PHP stores a binary tree. create a
representation. When it is converted between any two adjacent numbers, only one digit changes. It greatly reduces the logic confusion from one State to the next state. In addition, because the maximum and minimum numbers are only different, it is usually called Gray reflection code or cyclic code. The following table compares several natural binary codes with gray codes:
Decimal number
Natural
on the number of this form. Common BCD codes are represented in the following ways. 8421BCD encodingThis is the most widely used BCD code, is a kind of power code, and the rights of each of them are (from the most effective high-level to the least significant bit) 8,4,2,1. The example writes out the 8421BCD code corresponding to the 10-in number 563.97D.563.97d=0101 0110 0011. 1001 01118421BCD Example writes out the decimal number corresponding to
Title one: Print binary tree from top down
Each node of the two-fork tree is printed from top to bottom, and the same-level node prints from left to right.
The topic Analysis: This problem actually examines the tree traversal algorithm, the traversal usually has the preface, the middle order, the post-order traversal, this question examines the level traversal.
1, we need to use the queue, the implementation of print by layer, first put the root node
examples to introduce the hexadecimal and binary, decimal conversion method:Example 1, hexadecimal 0x7b (typically 0x prefixes represent the number of subsequent 26 binary) to binary and decimal.Convert to binary:As mentioned above, each character in hexadecimal is half a byte, we separate to see: 7=0111 and b=1011, so the whole byte is 01111011.Convert to decim
Gray code, a code invented by French engineer Jean-maurice-emlle Baudot in 1880, is an absolute encoding, and the typical gray code is a one-step complement with reflective and cyclic characteristics, its cyclic, The single-step feature eliminates the possibility of significant errors in random fetching, and its reflection and self-reinforcing properties make the negation very convenient. Gray code is a reliability code, is a fault minimization of the encoding method, because, although the natur
the octal digit to binary and convert it from binary to hexadecimal.
Octal: 1234567
To convert to binary is to convert each number to a three-digit binary: 001 010 011 100 101 110 111
Then, the numbers are grouped by four digits starting from the right side: 0 0101 0011 100
In this paper, we describe the clue of PHP implementation two fork tree and binary tree traversal method. Share to everyone for your reference, as follows:
bitree.php:
More readers interested in PHP related content can view the topic: "PHP Data structure and algorithm tutorial", "PHP operation and operator Usage Summary", "PHP Network Programming Tips", "PHP Basic Grammar Introductory Tutorial", "PHP operation Office Document tips summary (incl
Binary Tree Preorder Traversal:Given a binary tree, return the preorder traversal of its nodes ' values.For example:Given binary Tree {1,#,2,3} , 1 2 / 3Return [1,2,3] .Note:recursive solution is trivial, could do it iteratively?Recursive pre-order traversal is not used and can be implemented with the help of stacks. For a particular node, the sequ
First of all, the whole idea:Hex that contains decimals, we can first divide it into integers and decimal parts,Then the string comparison is made and the corresponding substitution is made.
Contains the binary decimal, the idea is similar, need to notice that the left integer is not enough four digits of the 0, the right is the same.
Import Java.math.BigDecimal; public class Test13 {public static void main (string[] args) {//16-two//TODO automatical
Binary to hexadecimal conversion plus a variety of hexadecimal operations, binary hexadecimalDecimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15Hexadecimal 0 1 2 3 4 5 6 7 8 9 a B c d e fBinary 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111So how to convert 5D to binary?The table above shows that 5 corresponds to 101, and d corresponds to 1101, then
the power of the number of decimal binary 2 the negative power of the second and then add in turn! As an example: 0101-Turn decimalThis is the conversion, if you are a novice, to see my information, estimated that my information is a bit for my personal writing, then I'll find you a few articles to learn the conversion:Http://jingyan.baidu.com/article/495ba84109665338b30ede98.htmlHttp://www.cnblogs.com/syq
int bitIndex = 0;27 long result = 0;28 29 for (int i = str.Length - 1; i >= 0; i--)30 {31 if (str[i] != ' ')32 {33 if (bitIndex == sizeInBits)34 {35 throw new OverflowException("binary literal too long: " + str);36 }37 38 if (str[i] == '1')39 {40
), the remaining number of other digits indicates the absolute value of the number. (Key: UnderstandingSymbol bitAndOther digits)
BytesOriginal code: An integer, which is converted to a binary number based on its absolute value. The leftmost highest bit uses 0 or 1 to indicate positive and negative, which is called the original code.
Example 1: the original code of positive number 5 is 0000 0101.
The
Basic ConceptsThe level of the node is defined from the root and the root is the first layer and the child of the root is the second layer.Height of the binary tree: the maximum level of the node in the tree is called the depth (Depth) or height of the tree.Two fork TreeIn computer science, a binary tree is an ordered tree with a maximum of two subtrees per node. Usually the root of the subtree is referred
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.